package com.eos.orm.mybatis.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.eos.orm.mybatis.dao.BrokerageTempDetailMapper;
import com.eos.orm.mybatis.model.BrokerageTempDetail;
import com.eos.orm.mybatis.model.BrokerageTempDetailExample;

/**
 * brokerage_temp_detail
 * 
 * @author sz
 * 
 */
public class BrokerageTempDetailMapperImpl extends AbstractSqlSessionFactory
		implements BrokerageTempDetailMapper {

	public int countByExample(BrokerageTempDetailExample example) {
		return 0;
	}

	public int deleteByExample(BrokerageTempDetailExample example) {
		return 0;
	}

	public int deleteByPrimaryKey(Integer id) {
		SqlSession session = sqlSessionFactory.openSession();
		try {
			BrokerageTempDetailMapper mapper = session
					.getMapper(BrokerageTempDetailMapper.class);
			mapper.deleteByPrimaryKey(id);
			session.commit();
			mapper = null;
		} catch (Exception e) {
			System.out
					.println("com.eos.orm.mybatis.dao.impl.BrokerageTempDetailMapperImpl.deleteByPrimaryKey throws exception:"
							+ e.getMessage());
			return -1;
		} finally {
			session.close();
		}
		return 0;
	}

	public int insert(BrokerageTempDetail record) {
		SqlSession session = sqlSessionFactory.openSession();
		try {
			BrokerageTempDetailMapper mapper = session
					.getMapper(BrokerageTempDetailMapper.class);
			mapper.insert(record);
			session.commit();
			mapper = null;
		} catch (Exception e) {
			System.out
					.println("com.eos.orm.mybatis.dao.impl.BrokerageTempDetailMapperImpl.insert throws exception:"
							+ e.getMessage());
			return -1;
		} finally {
			session.close();
		}
		return 0;
	}

	public int insertSelective(BrokerageTempDetail record) {
		return 0;
	}

	public List<BrokerageTempDetail> selectByExample(
			BrokerageTempDetailExample example) {
		List<BrokerageTempDetail> templist = new ArrayList<BrokerageTempDetail>();
		SqlSession session = sqlSessionFactory.openSession();
		try {
			BrokerageTempDetailMapper mapper = session
					.getMapper(BrokerageTempDetailMapper.class);
			templist = mapper.selectByExample(example);
			mapper = null;
		} catch (Exception e) {
			System.out
					.println("com.eos.orm.mybatis.dao.impl.BrokerageTempDetailMapperImpl.selectByExample throws exception:"
							+ e.getMessage());
		} finally {
			session.close();
		}
		return templist;
	}

	public BrokerageTempDetail selectByPrimaryKey(Integer id) {
		SqlSession session = sqlSessionFactory.openSession();
		try {
			BrokerageTempDetailMapper mapper = session
					.getMapper(BrokerageTempDetailMapper.class);
			return mapper.selectByPrimaryKey(id);
		} catch (Exception e) {
			System.out
					.println("com.eos.orm.mybatis.dao.impl.BrokerageTempDetailMapperImpl.selectByPrimaryKey throws exception:"
							+ e.getMessage());
		} finally {
			session.close();
		}
		return null;
	}

	public int updateByExample(BrokerageTempDetail record,
			BrokerageTempDetailExample example) {
		return 0;
	}

	public int updateByExampleSelective(BrokerageTempDetail record,
			BrokerageTempDetailExample example) {
		return 0;
	}

	public int updateByPrimaryKey(BrokerageTempDetail record) {
		return 0;
	}

	public int updateByPrimaryKeySelective(BrokerageTempDetail record) {
		SqlSession session = sqlSessionFactory.openSession();
		try {
			BrokerageTempDetailMapper mapper = session
					.getMapper(BrokerageTempDetailMapper.class);
			mapper.updateByPrimaryKeySelective(record);
			session.commit();
			mapper = null;
		} catch (Exception e) {
			System.out
					.println("com.eos.orm.mybatis.dao.impl.updateByPrimaryKeySelective.deleteByPrimaryKey throws exception:"
							+ e.getMessage());
			return -1;
		} finally {
			session.close();
		}
		return 0;
	}

}
